//package cn.hznc.security;
//
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
//import org.springframework.security.config.annotation.web.builders.HttpSecurity;
//import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
//import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
//import org.springframework.security.config.http.SessionCreationPolicy;
//import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
//import org.springframework.stereotype.Component;
//
///**
// * @Author：Administratorz
// * @Date：2023/5/22 15:40
// */
//@Component
//@EnableGlobalMethodSecurity(prePostEnabled = true)
//@Configuration
//@EnableWebSecurity //@EnableWebSecurity是开启SpringSecurity的默认行为
//public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
//
//    @Bean
//    public BCryptPasswordEncoder getBCryptPasswordEncoder() {
//        return new BCryptPasswordEncoder();
//    }
//
//    @Override
//    protected void configure(HttpSecurity http) throws Exception {
//        //super.configure(http);
//        //允许iframe嵌套显示
//        //放行资源
//        http.authorizeRequests()
//                .antMatchers("/login").permitAll()//放行登录请求
//                .anyRequest()
//                .authenticated();
//        //设置登录信息
//        http.formLogin()
//                .loginPage("/login")
//                .loginProcessingUrl("/employee/login")
//                .usernameParameter("username")
//                .passwordParameter("password")
//                .defaultSuccessUrl("/#/index")
//                .failureUrl("/login");
//        http.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS);
//        //设置注销信息
//        http.logout()
//                .logoutUrl("/logout")
//                .logoutSuccessUrl("/login");
//        http
//                .sessionManagement()
//                .enableSessionUrlRewriting(true);
//        //禁用csrf
//        http.csrf().disable();
//        //跨域处理
//        http.cors();
//        //设置自定义权限不足页面
//        http.exceptionHandling()
//                .accessDeniedHandler(new MyAccessDeniedHandler());
//    }
//
//}
